import request from '@/router/axios'
import store from '@/store'
import {fenExYuangettoFixed2,getUninstall,getSCOrLCOrACC,getStationName,getLineName} from "../../commonCheck";
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  viewBtn: false,
  editBtn: false,
  delBtn: false,
  emptyBtn: false,
  align: 'center',
  selection: true,
  reserveSelection:false,
  addBtn: false,
  height: 500,
  searchLabelWidth:100,
  column: [{
    fixed: true,
    label: '主键',
    prop: 'id',
    span: 24,
    hide: true
  }, {
    hide: false,
    width: 100 ,
    label: '线路',
    prop: 'lineCode',
    type: 'select',
    searchslot:true,
    search: true,
    display: true, // 动态显隐控制不能删除
    formatter:function (row,v) {
      return getLineName(v);
    }
  }, {
    hide: false,
    label: '站点',
    width: 180,
    prop: 'stationCode',
    type: 'select',
    search: true,
    searchslot:true,
    display: true ,// 动态显隐控制不能删除
    formatter:function (row,v) {
      return getStationName(row.lineCode,v);
    }
  }, {
    label: 'TVM编号',
    prop: 'tvmCode',
    width: 75,
    searchslot:true,
    type: 'input',
    hide: false,
    search: true,
    slot: true,
  }, {
    label: '钱箱类型',
    width: 90,
    prop: 'cashBoxType',
    formatter :function(row, value , label, column){
      return row.cashBoxTypeName;
    },
    search: false,
    hide: false,
    type:'select',
    dicData: [{
      label: '硬币回收箱',
      value: 1
    },{
      label: '硬币找零箱',
      value: 2
    },{
      label: '纸币回收箱',
      value: 3
    },{
      label: '纸币找零箱',
      value: 4
    },{
      label: '废钞箱',
      value: 5
    }]
  }, 
  // {
  //   label: '钱箱编号',
  //   width: 90,
  //   prop: 'cashBoxCode',
  //   search: false,
  //   hide: false,
  //   type:'select',
  //   dicData: [{
  //     label: '已卸载',
  //     value: 1
  //   },{
  //     label: '未卸载',
  //     value: 2
  //   },{
  //     label: '未卸载/已卸载',
  //     value: 3
  //   }]
  // },
   {
    label: '卸载状态',
    width: 70,
    prop: 'boxUninstallStatus',
    formatter :function(row, value , label, column){
      return getUninstall(value);
    },
    search: true,
    hide: false,
    type:'select',
    dicData: [{
      label: '已卸载',
      value: 1
    },{
      label: '未卸载',
      value: 2
    },{
      label: '未卸载/已卸载',
      value: 3
    }]
  }, {
    hide: false,
    label: '系统金额',
    prop: 'systemMoney',
    width: 90,
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed2(value);
    },
    type:'input'
  }, {
    hide: true,
    label: '卸载显示金额',
    prop: 'unloadDisplayMoney',
    width: 120,
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed2(value);
    },
    type: 'input'
  },{
    hide: false,
    width: 120,
    label: '卸载实点金额',
    prop: 'actualMoney',
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed2(value);
    },
    type: 'input'
  }, {
    hide: false,
    label: '补币金额',
    prop: 'supplementMoney',
    width: 90,
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed2(value);
    },
    search: false
  }, {
    hide: false,
    label: '手工清出金额',
    prop: 'handOutMoney',
    width: 120,
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed2(value);
    },
    search: false
  }, {
    hide: false,
    label: '差异金额',
    prop: 'diffMoney',
    width: 90,
    formatter:function(row, value , label, column){
      return fenExYuangettoFixed2(value);
    },
    search: false
  }, {
    hide: false,
    label: '数据来源',
    prop: 'dataSource',
    formatter :function(row, value , label, column){
      return row.dataSourceName;
    },
    search: true,
    type:'select',
    dicData: [
      {
      label: '修正',
      value: 1
    },
    {
      label: 'SC',
      value: 2
    },
    {
      label: '分钱箱票款差异协查',
      value: 6
    }
    // {
    //   label: 'LC',
    //   value: 3
    // },{
    //   label: 'ACC',
    //   value: 4
    // },
    ]
  }, {
    label: '收入日期',
    prop: 'recordTime',
    width: 90,
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    type:'date',
    hide: false,
    search: true
  }, {
    hide: false,
    label: '审核状态',
    prop: 'auditStatus',
    formatter :function(row, value , label, column){
      return row.auditStatusName;
    },
    type:'select',
    search: true,
    searchValue: 0,
    dicData: [{
      label: '待审核',
      value: 0
    }, {
      label: '审批通过',
      value: 1
    }]
  },{
    label: "审核日期",
     width: 90,
     prop: "auditTime",
	 format: 'yyyy-MM-dd',
     valueFormat: 'yyyy-MM-dd HH:mm:ss',
     type:'date'
  },{
    label: "审核人",
     width: 90,
      prop: "auditPersonName"
  },{
    type: 'select',
    prop:'diffReason',
    label: '差异原因',
    formatter :function(row, value , label, column){
      return row.diffReasonName;
    },
    dicUrl: "/admin/dict/type/select_reasons",
    search: true
  },{
    hide: false,
    width: 160,
	  searchLabelWidth:160,
    label: '是否加入报表差错',
    prop: 'isAddReprotError',
    type:'select',
    search: true,
    dicData: [{
      label: '是',
      value: '1'
    },{
      label: '否',
      value: '0'
    }]
  },{
    hide: false,
    label: '报表差错修改状态',
    width: 160,
    searchLabelWidth:160,
    prop: 'isModify',
    formatter:function(row, value , label, column){
      return value==0?'待修改':value==1?'已完成':'';
    },
    dicData: [{
      label: '待修改',
      value: '0'
    },{
      label: '已完成',
      value: '1'
    }]
  }, {
    label: '结算开始日期',
    width: 120,
    prop: 'incomeSettleBeginTime',
    type: 'date',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    editDisplay: false,
    addDisplay: false
  }, {
    label: '结算结束日期',
    width: 120,
    prop: 'incomeSettleEndTime',
    type: 'date',
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    editDisplay: false,
    addDisplay: false
  },
  {
    label: '是否补提交',
    width: 100,
    prop: 'additionalRecordingStatus',
    type: 'select',
    search: true,
    dicData: [{
      label: '否',
      value: '0'
    }, {
      label: '是',
      value: '1'
    }]
  }, {
    label: '录入人',
    width: 120,
    prop: 'passengerJobName',
    type:'input',
  }, {
    label: '录入人员工号',
    width: 120,
    prop: 'passengerJobNo',
    type:'input',
  },{
    label: '报表差错更改人',
    width: 120,
    prop: 'updateJobName',
    type:'input',
  }, {
    label: '更改人工号',
    width: 100,
    prop: 'updateJobNo',
    type:'input',
  }, {
    label: '更新时间',
    prop: 'updateTime',
    type:'date',
    format: 'yyyy-MM-dd HH:mm',
    valueFormat: 'yyyy-MM-dd HH:mm:ss'
  },{
    label: '修改原因备注',
    prop: 'reasonRemark',
    width: 350,         
    type: 'input'          
  }]
}

export const tableOptionEditTvm = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  align: 'center',
  menu: false,
  header: false,
  submitBtn: false,
  emptyBtn: false,
  labelWidth: 140,
  column: [ {
    hide: false,
    label: '数据来源',
    prop: 'dataSource',
    formatter :function(row, value , label, column){
      return getSCOrLCOrACC(value);
    },
    type:'select',
    dicData: [{
      label: '修正',
      value: '1'
    },{
      label: 'SC',
      value: '2'
    },{
      label: '分钱箱票款差异协查',
      value: '6'
    }],
    disabled: true
  },
  //修正
   {
    type:'number',
    label: '系统金额',
    prop: 'billOrderMoney',
    precision: 2,
    rules: [{
      required: true,
      message: "请填写系统金额",
      trigger: "blur"
    }],
    display: false
  },
  {
    label: '卸载实点金额',
    prop: 'actualMoney',
    type:'number',
    precision: 2,
    display: false,
    disabled: true,
    hide: true,
  },
  {
    label: '补币金额',
    prop: 'supplementMoney',
    type:'number',
    precision: 2,
    display: false,
    disabled: true,
    hide: true
  },
  {
    label: '手工清出金额',
    prop: 'handOutMoney',
    type:'number',
    precision: 2,
    display: false,
    disabled: true,
    hide: true
  },
  {
    label: '差异金额',
    prop: 'diffMoney',
    type:'number',
    precision: 2,
    display: false,
    disabled: true,
    hide: true
  },
  //SC
   {
    type:'number',
    label: '系统金额',
    prop: 'scUnloadAmount',
    precision: 2,
    rules: [{
      required: true,
      message: "请填写系统金额",
      trigger: "blur"
    }],
    display: false
  },{
    label: '卸载实点金额',
    prop: 'actualMoney',
    type:'number',
    precision: 2,
    display: false,
    disabled: true,
    hide: true,
  },
  {
    label: '补币金额',
    prop: 'supplementMoney',
    type:'number',
    precision: 2,
    display: false,
    disabled: true,
    hide: true
  },
  {
    label: '手工清出金额',
    prop: 'handOutMoney',
    type:'number',
    precision: 2,
    display: false,
    disabled: true,
    hide: true
  },
  {
    label: '差异金额',
    prop: 'diffMoney',
    type:'number',
    precision: 2,
    display: false,
    disabled: true,
    hide: true
  },
  //分钱箱审核结果
   {
    type:'number',
    label: '系统金额',    
	prop: 'replyUnloadDisplayMoney', //20241023  replyActualMoney
    precision: 2,
    rules: [{
      required: true,
      message: "请填写系统金额",
      trigger: "blur"
    }],
    display: false,
	hide: true,
  }, //20241023 增加
  {
    label: '卸载实点金额',
    prop: 'actualMoney',
    type:'number',
    precision: 2,
    display: false,
    disabled: true,
    hide: true,
  },
  {
    label: '补币金额',
    prop: 'supplementMoney',
    type:'number',
    precision: 2,
    display: false,
    disabled: true,
    hide: true
  },
  {
    label: '手工清出金额',
    prop: 'handOutMoney',
    type:'number',
    precision: 2,
    display: false,
    disabled: true,
    hide: true
  },
  {
    label: '差异金额',
    prop: 'diffMoney',
    type:'number',
    precision: 2,
    display: false,
    disabled: true,
    hide: true
  }, //20241023 增加结束
	/*	{
    label: '结算开始日期',
    prop: 'incomeSettleBeginTime',
    type: 'date',
    format: 'yyyy-MM-dd HH:mm:ss',
    valueFormat: 'yyyy-MM-dd',
    display: false
  }, {
    label: '结算结束日期',
    prop: 'incomeSettleEndTime',
    type: 'date',
    format: 'yyyy-MM-dd HH:mm:ss',
    valueFormat: 'yyyy-MM-dd',
    display: false
  },*/
  {
    label: '修改原因备注',
    prop: 'reasonRemark',
    width: 350,
    labelWidth: 130,
    type: 'textarea',
    rules: [{
      required: true,
      message: "请输入修改原因备注",
      trigger: "blur"
    }],
    hide: false,
    disabled: false
  }]
}

export const tableOptionEditRecordsSC = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  align: 'center',
  menu: false,
  addBtn: false,
  submitBtn: false,
  emptyBtn: false,
  column: [ {
    hide: false,
    label: '数据来源',
    prop: 'dataSource',
    formatter :function(row, value , label, column){
      return getSCOrLCOrACC(value);
    },
    type:'select',
    dicData: [{
      label: '修正',
      value: '1'
    },{
      label: 'SC',
      value: '2'
    },{
      label: '分钱箱票款差异协查',
      value: '6'
    }]
  },
  //SC
   {
    type:'number',
    label: '系统金额',
    prop: 'oldSystemMoney',
    formatter:function(row, value , label, column){
      var num =value / 100;
      num = num.toFixed(2);
      return num;
    }
  }, {
    label: '系统金额更改人',
    prop: 'creatorName',
    type:'input',
  }, {
    label: '更改人工号',
    prop: 'creatorId',
    type:'input',
  },{
    label: '更新时间',
    prop: 'createTime',
    type:'date',
    format: 'yyyy-MM-dd HH:mm',
    valueFormat: 'yyyy-MM-dd HH:mm:ss'
  }]
}

export const tableOptionEditRecordsJZDJ = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  align: 'center',
  menu: false,
  addBtn: false,
  submitBtn: false,
  emptyBtn: false,
  column: [ {
    hide: false,
    label: '数据来源',
    prop: 'dataSource',
    formatter :function(row, value , label, column){
      return getSCOrLCOrACC(value);
    },
    type:'select',
    dicData: [{
      label: '修正',
      value: '1'
    },{
      label: 'SC',
      value: '2'
    },{
      label: '分钱箱票款差异协查',
      value: '6'
    }]
  },
  //结账单据
   {
    type:'number',
    label: '系统金额',
    prop: 'billOrderMoney',
    formatter:function(row, value , label, column){
      var num =value / 100;
      num = num.toFixed(2);
      return num;
    }
  }, {
    label: '更改人',
    prop: 'creatorName',
    type:'input',
  }, {
    label: '更改人工号',
    prop: 'creatorId',
    type:'input',
  },{
    label: '更新时间',
    prop: 'createTime',
    type:'date',
    format: 'yyyy-MM-dd HH:mm',
    valueFormat: 'yyyy-MM-dd HH:mm:ss'
  }]
}
export const tableOptionEditRecordsFQX = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  align: 'center',
  menu: false,
  addBtn: false,
  submitBtn: false,
  emptyBtn: false,
  column: [ {
    hide: false,
    label: '数据来源',
    prop: 'dataSource',
    formatter :function(row, value , label, column){
      return getSCOrLCOrACC(value);
    },
    type:'select',
    dicData: [{
      label: '修正',
      value: '1'
    },{
      label: 'SC',
      value: '2'
    },{
      label: '分钱箱票款差异协查',
      value: '6'
    }]
  },
  //分钱箱审核结果
   {
    type:'number',
    label: '系统金额',
    prop: 'replyActualMoney',
    formatter:function(row, value , label, column){
      var num =value / 100;
      num = num.toFixed(2);
      return num;
    }
  }, {
    label: '更改人',
    prop: 'creatorName',
    type:'input',
  }, {
    label: '更改人工号',
    prop: 'creatorId',
    type:'input',
  },{
    label: '更新时间',
    prop: 'createTime',
    type:'date',
    format: 'yyyy-MM-dd HH:mm',
    valueFormat: 'yyyy-MM-dd HH:mm:ss'
  }]
}


export const tableOptionChaYi = {
  
  submitBtn: false,
  emptyBtn: false,
  column: [{
    "type": "select",
    "label": "差异原因",
    "prop": "diffReason",
    cell: true,
    dicUrl: "/admin/dict/type/select_reasons",
    // dicData: [{
    //   label: '平账',
    //   value: 1
    // }, {
    //   label: '补币或清点错误',
    //   value: 2
    // },{
    //   label: '系统原因',
    //   value: 3
    // },{
    //   label: '待确认',
    //   value: 4
    // }]
  }]
}
export function getDifferencesInAudit(param) {
  return request({
    url: '/check/check/getDifferencesInAudit',
    method: 'post',
    params: param
  })
}

export function getListCionMOney(param) { //获取硬币钱箱列表
  return request({
    url: '/check/check/getListCionMOney',
    method: 'post',
    params: param
  })
}

export function getListCionMOneyById(param) { //获取硬币钱箱列表
  return request({
    url: '/check/check/getListCionMOneyById',
    method: 'get',
    params: param
  })
}

export function getClearOutAmount(param){//手工清出金额
  return request({
    url: '/check/check/getClearOutAmount',
    method: 'post',
    params: param
  })
}
export function updateAuditStatus(param) {
  return request({
    url: '/check/check/updateAuditStatus',
    method: 'post',
    params: param
  })
}
export function update(obj){
  return request({
    url: '/check/check/updateSwAuTvmBoxAmountDefference',
    method: 'post',
    data: obj
  })
}
//查看TVM分钱箱批量审核历史记录
export function queryPastRecords(param){
  return request({
    url: '/check/check/SwAuTvmBoxAmountDefferenceLogIdList/'+param.id+'/'+param.cashBoxType+'/'+param.dataSource,
    method: 'get'
  })
}

export function insertSwAuTvmMoneyAssist(param) {
  return request({
    url: '/check/check/insertSwAuTvmMoneyAssist',
    method: 'post',
    params: param
  })
}
export function insertSwAuTvmCashboxAmountHierarchyDifference(param) {
  return request({
    url: '/check/check/insertSwAuTvmCashboxAmountHierarchyDifference',
    method: 'post',
    params: param
  })
}
export function replaceSystemAmounts(param) {
  return request({
    url: '/check/check/replaceSystemAmounts',
    method: 'post',
    params: param
  })
}
export function syncCashBoxBatchAuditSystemAmounts(param) {
  return request({
    url: '/check/check/syncCashBoxBatchAuditSystemAmounts',
    method: 'post',
    params: param
  })
}
export function heji(value){
  var num = value / 100;
  num = num.toFixed(2);
  return num;
}

export function updateDifferences(param) {
  return request({
    url: '/check/check/updateDiffReason',
    method: 'post',
    params: param
  })
}

/**
 * 撤回
 * @param {} query 
 * @returns 
 */
 export function revoke (query) {
  return request({
    url: '/check/check/revokeTvmBoxIds',
    method: 'put',
    params: query
  })
}